package com.os.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.os.service.UpdateStoreServiceH;
import com.os.serviceimpl.UpdateStoreServiceImplH;

import net.sf.json.JSONObject;
/**
 * 修改库存控制者类
 * @author HQG 2017年1月4日
 *
 */
public class UpdateStoreControllerH extends HttpServlet{

	UpdateStoreServiceH as = new UpdateStoreServiceImplH();
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		int fid = Integer.parseInt(req.getParameter("fid"));
		int fnums = Integer.parseInt(req.getParameter("fnums"));
		PrintWriter pw = resp.getWriter();
		int flag = as.updateStoreH(fid, fnums);
		JSONObject jo = new JSONObject();
		jo.put("flag", flag);
		pw.write(jo.toString());
		pw.flush();
		pw.close();		
	}
}
